package org.flashbrighton.as3bots.views.ui
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	import org.flashbrighton.as3bots.bots.BaseBot;
	import org.flashbrighton.as3bots.models.GameModel;
	
	public class Names extends Sprite
	{
		private var _model:GameModel;
		
		public function Names(model:GameModel)
		{
			_model = model;
			init();	
		}
		
		
		public function init():void
		{
			var bot:BaseBot;
			var t:TextField;
			
			for each (bot in _model.botList)
			{
				t = createTextField(bot.botName);
				t.x = bot.model.body.x;
				t.y = bot.model.body.y + 30;
				addChild(t);
			}
			
			t = createTextField("** PRESS SPACE TO START **");
			t.x = 0;
			addChild(t);
		}
		
		
		private function createTextField(botName:String):TextField
		{
			var t:TextField = new TextField();
			t.defaultTextFormat = new TextFormat("Arial", 12, 0xFFFFFF);
			t.autoSize = TextFieldAutoSize.CENTER;
			t.text = botName;
			return t;
		}

	}
}